home *** CD-ROM | disk | FTP | other *** search
/ The CICA Windows Explosion! / The CICA Windows Explosion! - Disc 2.iso / misc / gs261src.zip / pcharstr.ps < prev    next >
Text File  |  1993-05-28  |  2KB  |  68 lines

  1. %    Copyright (C) 1990, 1992 Aladdin Enterprises.  All rights reserved.
  2. %
  3. % This file is part of Ghostscript.
  4. %
  5. % Ghostscript is distributed in the hope that it will be useful, but
  6. % WITHOUT ANY WARRANTY.  No author or distributor accepts responsibility
  7. % to anyone for the consequences of using it or for whether it serves any
  8. % particular purpose or works at all, unless he says so in writing.  Refer
  9. % to the Ghostscript General Public License for full details.
  10. %
  11. % Everyone is granted permission to copy, modify and redistribute
  12. % Ghostscript, but only under the conditions described in the Ghostscript
  13. % General Public License.  A copy of this license is supposed to have been
  14. % given to you along with Ghostscript so you can know your rights and
  15. % responsibilities.  It should be in a file named COPYING.  Among other
  16. % things, the copyright notice and this notice must be preserved on all
  17. % copies.
  18.  
  19. % pcharstr.ps
  20. % Print the CharStrings and Subrs (if present) from a Type 1 font,
  21. % in symbolic form.
  22.  
  23. % Load the Type 1 utilities.
  24. (type1ops.ps) run
  25.  
  26. /printcs
  27.  { dup type /stringtype eq
  28.     { printcs1 (\n) print }
  29.     { ( ) print == }
  30.    ifelse
  31.  } bind def
  32. /printcs1
  33.  { 4330 exch dup length string .type1decrypt exch pop
  34.    dup length lenIV sub lenIV exch getinterval
  35.    save exch 0 () /SubFileDecode filter
  36.    mark exch charstack_read
  37.    counttomark 1 sub -1 0
  38.     { index ( ) print ==only
  39.     }
  40.    for cleartomark restore
  41.  } bind def
  42.  
  43. /printfont
  44.  { currentfont begin Private begin 10 dict begin
  45.    gsave nulldevice FontMatrix matrix invertmatrix concat
  46.    0 1 Encoding length 1 sub
  47.     { dup Encoding exch get dup /.notdef eq
  48.        { pop pop
  49.        }
  50.        { 1 index =only ( ) print ==only ( ) print
  51.          ( ) dup 0 4 -1 roll put
  52.          newpath 0 0 moveto false charpath
  53.      [ pathbbox ] ==
  54.        }
  55.       ifelse
  56.     } for
  57.    grestore
  58.    CharStrings { exch ==only printcs } forall
  59.    /Subrs where
  60.     { pop    % the dictionary
  61.       0 1 Subrs length 1 sub
  62.        { dup =only
  63.          Subrs exch get printcs
  64.        } for
  65.     } if
  66.    end end end
  67.  } bind def
  68.